#!/usr/bin/ruby -w
# -* coding: UTF-8 -*-

################################################################################
# Copyright 2009 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
################################################################################

# Configuration file for the extension. Generates a Makefile for compilation.

require 'mkmf'

if not find_library('pthread', 'pthread_create')
  puts 'Error: pthread library not found'
  exit 1
end

if not find_library('mysqlclient_r', 'mysql_query')
  puts 'Error: mysqlclient_r library not found'
  exit 1
end

if not have_header('mysql.h') and not have_header('mysql/mysql.h')
  puts 'Error: mysql.h not found'
  exit 1
end

cflags = ENV['DEBUG'] ? "-g" : ""
with_cflags(cflags) do
  create_makefile "shardeddb"
end
